<template>
<div class="mina2" ref="my_chart"></div>


</template>

<script>
var echarts = require("echarts");
require('echarts/lib/chart/bar');
export default {
  created() {
    this.dataStatistics();   
   
  },
  mounted(){

        this.setpic()
       console.log(this.$refs.my_chart)
  },
  methods: {
    async dataStatistics() {
      const res = await this.$http.get("reports/type/1");
      console.log(res);
    },
    setpic() {
      var myChart = echarts.init(this.$refs.my_chart);
      myChart.setOption({
        title: {
          text: "ECharts 入门示例"
        },
        tooltip: {},
        legend:{
          data:['销量']
        },
        xAxis: { //x轴数据
          data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
        },
        yAxis: {}, //y轴数据
        series: [ //s鼠标移动上去的显示
          {
            name: "销量",
            type: "bar",
            data: [5, 20, 36, 10, 10, 20]
          }
        ]
      });
    }
  },
  beforeRouteEnter(to,from,next){
    next()
  }
};
</script>

<style lang="scss" scoped>
.mina2{
  height: 380px;
}</style>
